package main

import "fmt"

//接口学习文档
//定义人
type personInterface interface {
    badEgg
    SayHello()
}

type person struct {
    name string
    old string
    job string
}

func (p person) SayHello() {
    fmt.Printf("hello, my name is %s, job %s, old %s\n", p.name, p.job, p.old)
}

//func (p person) doBadThing() {
//   fmt.Println("do nothing")
//}

//定义坏蛋，有干坏事的行为，都是坏蛋
type badEgg interface {
    doBadThing()
}

//定义坏事的时间，地点，行为
type badThing struct {
    time string
    addr string
    action string
}

//性侵犯的坏蛋
type sexEgg struct {
    name string
    sex string //male, female
    thing badThing
}
func (s sexEgg)doBadThing() {
    fmt.Printf("知名 %s 明星 %s %s 在 %s 进行 %s\n",
        s.sex, s.name, s.thing.time, s.thing.addr, s.thing.action)
    return
}

//吸毒的坏蛋
type drugEgg struct {
    name string
    sex string
    drug string //名称
    thing badThing
}
func (d drugEgg)doBadThing() {
    fmt.Printf("知名 %s 明星 %s %s 在 %s 进行 %s %s\n",
        d.sex, d.name, d.thing.time, d.thing.addr, d.thing.action, d.drug)
    return
}

//打人的坏蛋
type hitEgg struct {
    name string
    job string
    thing badThing
}
func (h hitEgg)doBadThing() {
    fmt.Printf("%s %s 又 %s 了, 嘿\n", h.job, h.name, h.thing.action)
    return
}

type chaoYangPeople struct {name string}

func (p chaoYangPeople)report(egg badEgg) {
    fmt.Printf("收到来自朝阳群众\"%s\"的举报：", p.name)
    egg.doBadThing()
}

func main() {
    //坏蛋列表
    lyd := sexEgg{name:"李云迪", sex:"男", thing:badThing{time:"2021-10-21", addr:"家里", action:"嫖娼"}}
    wyf := sexEgg{name:"吴亦凡", sex:"男", thing:badThing{time:"2021-7-16", addr:"家里", action:"强奸"}}
    ldm := drugEgg{name:"李代沫", sex:"男", drug:"冰毒", thing:badThing{time:"2014-3-18", addr:"家里", action:"吸毒"}}
    gdg := hitEgg{name:"郭德纲", job:"说相声的", thing:badThing{time:"2010-8-1", addr:"家里", action:"打人"}}
    jjf := hitEgg{name:"蒋劲夫", job:"演员", thing:badThing{time:"2019-11-26", addr:"家里", action:"家暴"}}

    zhang3 := chaoYangPeople{name:"法外狂徒张三"}
    zhang3.report(lyd)
    zhang3.report(wyf)
    zhang3.report(ldm)

    yuQian := chaoYangPeople{name:"于谦"}
    yuQian.report(gdg)
    yuQian.report(jjf)

    chaoYangPeople{}.report(lyd)

    unName := person {name:"none", old:"1", job:"coder"}
    unName.SayHello()
    //unName.doBadThing()

    return
}


